import request from './request'
// 0.下载文件
export const fileDownload = (url) => {
	return request(url, {
		method: 'get',
		responseType: 'blob',
		onDownloadProgress: function(progressEvent){
			if (progressEvent.lengthComputable){
				let downLoadProgress = null
				downLoadProgress = progressEvent.loaded / progressEvent.total * 100
			}
		}
	})
}

// 1.登录接口
export const login = (data) => {
	return request.post('/api/login', data)
}

// 77. 查询各部门员工变化图
export const getUserData = (data) => {
	return request.get('/my/getUserData', {
		params: {
			year: data
		}
	})
}

// 78. 查询各部门当日考勤人数
export const getAttendanceData = (data) => {
	return request.get(`/my/getAttendanceData?day_date=${data.day_date}&department_id=${data.department_id}`)
}

// 79. 查询项目数量
export const getProjectData = () => {
	return request.get('/my/getProjectData')
}

// 78.查询工资流水
export const getSalaryData = (data) => {
	return request.get(`/my/getSalaryData?year=${data}`)
}

// 6.分页查询用户信息
export const getUserList = () => {
	return request.get(`/my/getUserList`)
}

// 7. 通过用户姓名分页查询用户信息
export const getUserName = (data) => {
	return request.get(`/my/getUserName?name=${data.userNameValue}`)
}

// 8. 通过id查询用户详细信息
export const getUser = (id) => {
	return request.get(`/my/getUser?id=${id}`)
}

// 29. 选择框查询部门
export const getDepartmentList = () => {
	return request.get('/my/getDepartmentList')
}

// 5. 更新用户信息
export const updateUser = (data) => {
	return request.post('/my/updateUser', data)
}

// 13. 转正（表单提交）
export const regularization = (data) => {
	return request.post('/my/regularization', data)
}

// 14. 离职（表单提交）
export const leave = (data) => {
	return request.post('/my/leave', data)
}

// 9. 记录保险（批量添加）
export const addInsurance = (data) => {
	return request.post('/my/addInsurance', data)
}

// 12. 修改保险
export const updateInsurance = (data) => {
	return request.post('/my/updateInsurance', data)
}

// 4. 新建用户接口
export const addUser = (data) => {
	return request.post('/my/addUser', data)
}

// 28. 分页查询部门列表
export const getDepartment = () => {
	return request.get('/my/getDepartment')
}

// 22. 启用/禁用部门
export const startDepartment = (data) => {
	return request.post('/my/startDepartment', data)
}

// 21. 添加二级部门
export const addDepartmentSon = (data) => {
	return request.post('/my/addDepartmentSon', data)
}

// 20. 添加一级部门
export const addDepartment = (data) => {
	return request.post('/my/addDepartment', data)
}

// 25. 批量删除部门
export const deleteDepartmentList = (data) => {
	return request.post('/my/deleteDepartmentList', data)
}

// 26. 修改一级部门
export const updateDepartment = (data) => {
	return request.post('/my/updateDepartment', data)
}

// 27. 修改二级部门
export const updateDepartmentSon = (data) => {
	return request.post('/my/updateDepartmentSon', data)
}

// 23. 删除一级部门
export const deleteDepartment = (data) => {
	return request.post('/my/deleteDepartment', data)
}

// 24. 删除二级部门
export const deleteDepartmentSon = (data) => {
	return request.post('/my/deleteDepartmentSon', data)
}

// 35. 查询岗位列表
export const getPositionList = () => {
	return request.get('/my/getPositionList')
}

// 33. 启用，禁用岗位
export const startPosition = (data) => {
	return request.post('/my/startPosition', data)
}

// 32. 更新岗位
export const updatePosition = (data) => {
	return request.post('/my/updatePosition',data)
}

// 31. 删除岗位
export const deletePosition = (data) => {
	return request.post('/my/deletePosition', data)
}

// 30. 添加岗位
export const addPosition = (data) => {
	return request.post('/my/addPosition', data)
}

// 16. id查询工资条(未提交，已提交)
export const getAllSalary = (data) => {
	return request.get(`/my/getAllSalary?ids=${data}`)
}

// 17. 保存工资条
export const saveSalary = (data) => {
	return request.post('/my/saveSalary', data)
}

// 18. 提交工资条
export const submitSalary = (data) => {
	return request.post('/my/submitSalary', data)
}

// 20. id查看个人工资记录
export const getUserSalary = (data) => {
	return request.get(`/my/getUserSalary?s_user_id=${data}`)
}

// 37. 查询公司考勤信息
export const getCompanyAttendance = (data) => {
	return request.get(`/my/getCompanyAttendance?year=${data.year}&month=${data.month}`)
}

// 38. 查询部门考勤信息
export const getDepartmentAttendance = (query) => {
	return request.get(`/my/getDepartmentAttendance?year=${query.year}&month=${query.month}&department_id=${query.department_id}`)
}

// 39. 查询用户考勤信息
export const getUserAttendance = (query) => {
	return request.get(`/my/getUserAttendance?year=${query.year}&month=${query.month}&user_id=${query.user_id}`)
}

// 40. 查询用户考勤统计
export const getUserAttendanceStat = (query) => {
	return request.get(`/my/getUserAttendanceStat?year=${query.year}&month=${query.month}&user_id=${query.user_id}`)
}

// 41. 申请调休
export const applyRest = (body) => {
	return request.post('/my/applyRest', body)
}

// 46. 申请加班
export const applyOvertime = (body) => {
	return request.post('/my/applyOvertime', body)
}

// 42. 查询自己的调休申请
export const getRestLog = (query) => {
	return request.get(`/my/getRestLog?user_id=${query}`)
}

// 47. 查询自己的加班申请
export const getOvertimeLog = (query) => {
	return request.get(`/my/getOvertimeLog?user_id=${query}`)
}

// 52. 查询考勤初始化
export const getInitial = () => {
	return request.get('/my/getInitial')
}

// 51. 考勤初始化
export const updateInitial = (body) => {
	return request.post('/my/updateInitial', body)
}

// 53. 节假日设置
export const holidaysRest = (body) => {
	return request.post('/my/holidaysRest', body)
}

// 43. 查询由自己审批的调休申请
export const getAuditRsetLog = (query) => {
	return request.get(`/my/getAuditRsetLog?user_id=${query.user_id}`)
}

// 45. 同意调休申请
export const agreeRest = (body) => {
	return request.post('/my/agreeRest', body)
}

// 44. 拒绝调休申请
export const refuseRest = (body) => {
	return request.post('/my/refuseRest', body)
}

// 48. 查询由自己审批的加班申请
export const getAuditOvertimeLog = (query) => {
 	return request.get(`/my/getAuditOvertimeLog?user_id=${query.user_id}`)
 }
 
// 50. 同意加班申请
export const agreeOvertime = (body) => {
	return request.post('/my/agreeOvertime', body)
}
 
// 49. 拒绝加班申请
export const refuseOvertime = (body) => {
	return request.post('/my/refuseOvertime', body)
}
 
// 19. 查询工资条（已提交，已审核）
 export const getSubmitSalary = () => {
	 return request.get('/my/getSubmitSalary')
 }
 
 // 19. 通过工资条
 export const agreeSalary = (body) => {
 	return request.post('/my/agreeSalary', body)
 }
 
 // 2. 修改密码
 export const updatePassword = (body) => {
 	return request.post('/my/updatePassword', body)
 }
 
// 58. 日历项目查询
 export const getProject = (query) => {
	 return request.get(`/my/getProject?start_date=${query.start_date}&end_date=${query.end_date}`)
 }
 
 // 61. 分页查询项目列表
export const getProjectList = (query) => {
	return request.get(`/my/getProjectList?page_num=${query.page_num}&page_size=${query.page_size}`)
}

// 22. 获取选择框用户下拉列表
 export const getUserSelectList = () => {
	 return request.get('/my/getUserSelectList')
 }
 
 // 56. 添加项目
 export const addProject = (body) => {
 	return request.post('/my/addProject', body)
 }
 
 // 63. 批量删除项目
 export const deleteProjectList = (body) => {
 	return request.post('/my/deleteProjectList', body)
 }

// 58. 删除项目
export const deleteProject = (body) => {
	return request.post('/my/deleteProject', body)
}

// 63. 状态进度查询项目列表
export const stateProjectList = (query) => {
	return request.get(`/my/stateProjectList?page_num=${query.page_num}&page_size=${query.page_size}&project_state=${query.project_state}&project_name=${query.project_name}`)
}

// 61. 查询项目详情
export const getProjectBody = (query) => {
	return request.get(`/my/getProjectBody?project_id=${query.project_id}`)
}

// 57. 编辑项目
export const updateProject = (body) => {
	return request.post('/my/updateProject', body)
}

// 70. 初稿提交
export const projectFirstDraft = (body) => {
	return request.post('/my/projectFirstDraft', body)
}

// 72. 项目完结
export const projectEnd = (body) => {
	return request.post('/my/projectEnd', body)
}

// 70. 初稿流单
export const projectFail = (body) => {
	return request.post('/my/projectFail', body)
}

// 71. 修改延长
export const projectRewrite = (body) => {
	return request.post('/my/projectRewrite', body)
}

// 65. 获取已上传文件-断点续传
export const projectUploadAlready = (query) => {
	return request.get(`/my/projectUploadAlready?HASH=${query.HASH}`)
}

// 66. 上传切片-断点续传
export const projectUploadChunk = (body) => {
	return request.post('/my/projectUploadChunk', body)
}

// 67. 合并切片-断点续传
export const projectUploadMerge = (body) => {
	return request.post('/my/projectUploadMerge', body)
}

// 74. 删除项目文件
export const deleteProjectFile = (body) => {
	return request.post('/my/deleteProjectFile', body)
}

// 69. 批量删除图片
export const deleteProjectImage = (body) => {
	return request.post('/my/deleteProjectImage', body)
}

// 75. 插入投票
export const addVote = (body) => {
	return request.post('/my/addVote', body)
}

// 76.插入选项
export const addOption = (body) => {
	return request.post('/my/addOption', body)
}

// 77.查询投票
export const getVote = (query) => {
	return request.get(`/my/getVote?user_id=${query.user_id}`)
}

// 78.进行投票
export const castVote = (body) => {
	return request.post(`/my/castVote`, body)
}

// 79.删除投票
export const deleteVote = (body) => {
	return request.post(`/my/deleteVote`, body)
}

// 80.发布留言
 export const addIdea = (body) => {
	 return request.post('/my/addIdea', body)
 }
 
 // 81.查询留言
export const getIdea = () => {
	return request.get('/my/getIdea')
}

// 82.点赞留言
export const agreeIdea = (body) => {
	return request.post('/my/agreeIdea', body)
}

// 87.查询权限列表
export const getActivityList = () => {
	return request.get('/my/getActivityList')
}

// 88.更新权限列表
export const updateActivity = body => {
	return request.post('/my/updateActivity', body)
}

// 89.更新权限列表
export const addActivity = body => {
	return request.post('/my/addActivity', body)
}

// 90.更新权限列表
export const deleteActivity = body => {
	return request.post('/my/deleteActivity', body)
}

// 37.选择框查询岗位
export const getPosition = () => {
	return request.get('/my/getPosition')
}

// 56.查询具备审核权限的人员列表
export const getExamineUserList = (query) => {
	return request.get(`/my/getExamineUserList?type=${query.type}`)
}

// 91.获取徽标信息
export const getReddotApi = (query) => {
	return request.get(`/my/getReddot?user_id=${query.user_id}`)
}